import React, { useState, useEffect } from "react";

const BlogList = () => {
  // 相当于 class 组件内的 state
  const [list, setList] = useState([]);

  // 相当于 class 组件中的生命周期方法
  useEffect(async () => {
    const res = await this.request.get("/blogs");
    setList(res.data);
  }, []);

  return <div className="blog-list">
      {
          list.map(blog => {
              return <div></div>
          })
      }
  </div>;
};

export default BlogList;
